<?php

namespace app\admin\model\yiliao;

use think\Model;


class User extends Model
{

    

    

    // 表名
    protected $name = 'yiliao_user';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'coupondata_text',
        'orderdata_text',
        'status_text'
    ];
    

    
    public function getCoupondataList()
    {
        return ['1' => __('Coupondata 1'), '0' => __('Coupondata 0')];
    }

    public function getOrderdataList()
    {
        return ['1' => __('Orderdata 1'), '0' => __('Orderdata 0')];
    }

    public function getStatusList()
    {
        return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
    }


    public function getCoupondataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['coupondata']) ? $data['coupondata'] : '');
        $list = $this->getCoupondataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getOrderdataTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['orderdata']) ? $data['orderdata'] : '');
        $list = $this->getOrderdataList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
